package jdk5.meta;

import java.util.Date;
import static java.lang.System.out;
import java.text.DateFormat;
import static java.text.DateFormat.*;
import static java.util.Locale.US;
import java.lang.reflect.Method;

public class TimeTravel{

      @RequestForEnhancement(
             id =  1868724,
             synopsis =  "Enable time-travel",
             engineer = "Mr. Bean",
             date = "4/1/3007"
      )
      public static void travelThroughTime(Date destination){
              out.println(destination);            
      } 

     public static void main(String[] args) throws Exception{
           Method m = TimeTravel.class.getMethod(
                      "travelThroughTime",
                       new Class[] {Date.class}
//                      		Date.class
                          );
           RequestForEnhancement rfe = m.getAnnotation(RequestForEnhancement.class);
           if(rfe != null){
               DateFormat df = DateFormat.getDateInstance(SHORT, US);
                Date d = df.parse(rfe.date());
                m.invoke(null, new Object[]{d});
           }         
     }
}